package me.android.library.common.orm.ability;

import com.google.common.base.Preconditions;

import cn.hutool.core.util.ArrayUtil;
import mylab.utils.common.StringUtil;

public interface EntityInfo<T> {
    static void checkWhere(String whereClause, String[] whereArgs) {
        if (StringUtil.isEmpty(whereClause)) {
            return;
        }
        int placeholderCount = StringUtil.count(whereClause, "?");
        if (placeholderCount > 0) {
            Preconditions.checkState(ArrayUtil.isNotEmpty(whereArgs), "条件参数为空");
            Preconditions.checkState(placeholderCount == whereArgs.length, "条件参数与占位符数量不一致");
        }
    }

    String getTableName();

    Class<T> getEntityClass();
}
